<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机点名</title>
</head>
<style>
    span{
        display: block;
        width: 50px;
        border:2px solid #F00;
    }
    
</style>
<body>
    <div>
      点名  <span></span>
    </div>
    <script>
        //1.获取元素
       const box= document.querySelector('span')
        //2.定义数组
        let arr=['赵云','霍仲昂','关于','马超','刘备']
        //产生随机数
        function getRandom(min,max){
            return (Math.floor(Math.random()*(max-min+1))+min)
        }
        //3.得到随机数
        let random=getRandom(0,arr.length-1)
        console.log(random);
        //4.修改元素内容
        box.innerHTML=arr[random]

        //5.删除使用过的数组内容
        arr.splice(random,1)
        console.log(arr);
    </script>
    
</body>
</html>